package cn.superchart.module.rolemenu.service.impl;

import cn.superchart.module.rolemenu.entity.RoleMenu;
import cn.superchart.module.rolemenu.mapper.RoleMenuMapper;
import cn.superchart.module.rolemenu.service.RoleMenuService;
import cn.superchart.module.uerole.entity.ScUserRole;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import cn.superchart.common.base.BaseServiceImpl;
import cn.superchart.module.rolemenu.param.*;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2024-12-09
 */
@Service
@Slf4j
public class RoleMenuServiceImpl extends  BaseServiceImpl<RoleMenu, RoleMenuMapper>  implements RoleMenuService {



         @Transactional(rollbackFor = Exception.class)
         @Override
         public void add(RoleMenuAddParam roleMenuAddParam) {
            String pk = super.saveData(roleMenuAddParam);
            log.info(pk);
         }

         @Transactional(rollbackFor = Exception.class)
         @Override
         public void edit(RoleMenuEditParam roleMenuEditParam) {
            super.updateData(roleMenuEditParam);
         }

         @Override
         public RoleMenuDetailParam detail(String id) {
             return queryData(id,RoleMenuDetailParam.class);
         }

         @Override
         public Page<RoleMenuDetailParam> page(RoleMenuPageParam roleMenuPageParam) {
             return super.page(roleMenuPageParam,RoleMenuDetailParam.class);
         }

        @Override
        public void removeByRoleId(String roleId) {
            LambdaQueryWrapper<RoleMenu> queryWrapper =  queryWrapper().lambda().eq(RoleMenu::getRoleId,roleId);
            super.remove(queryWrapper);
        }


}
